% 手动定义第一条线的坐标
iterations1 = [1, 40, 80, 120, 160, 200, 240, 280, 320, 360, ...
               400, 440, 480, 520, 560, 600, 640, 680, 720, 760, ...
               800, 840, 880, 920, 960, 1000];
average_access_rates1 =  [0.31,0.30,0.313,0.31,0.32,0.3,0.29,0.285,0.28,0.277,...,
  0.27,0.26,0.248,0.246,0.242,0.24,0.239,0.235,0.230,0.226,...
  0.220,0.216,0.221,0.220,0.223,0.220];

% 手动定义第二条线的坐标
iterations2 = iterations1; % 使用相同的迭代次数
average_access_rates2 = [0.225,0.227,0.23,0.231,0.228,0.23,0.215,0.185,0.166,0.155,...,
  0.155,0.155,0.152,0.15,0.148,0.146,0.146,0.143,0.146,0.147,...
  0.143,0.147,0.143,0.147,0.146,0.147];
 
% 手动定义第三条线的坐标
iterations3 = iterations1; % 使用相同的迭代次数
average_access_rates3 = [0.195,0.19,0.193,0.192,0.195,0.185,0.184,0.182,0.1646,0.1535,...,
  0.155,0.135,0.112,0.134,0.128,0.126,0.126,0.125,0.122,0.127,...
  0.123,0.127,0.123,0.127,0.123,0.124];
 
% 绘制图形
figure;
plot(iterations1, average_access_rates1, '-o','LineWidth', 2,  'DisplayName', 'DQN');
hold on; % 保持当前图形
plot(iterations2, average_access_rates2, '-s', 'LineWidth', 2,'DisplayName', 'D3QN');
plot(iterations3, average_access_rates3, '-d','LineWidth', 2,  'DisplayName', 'FL-D3QN');
hold off;
 
% 添加标签和图例
xlabel('迭代次数');
ylabel('与PU的平均碰撞概率');


legend('show'); % 显示图例